﻿using System.Collections.Generic;

namespace com.binance.client
{

	using ResponseResult = com.binance.client.model.ResponseResult; 
	using com.binance.client.model.market;
	using com.binance.client.model.enums;
	using com.binance.client.model.trade;

	/// <summary>
	/// Synchronous request interface, invoking Binance RestAPI via synchronous
	/// method.<br>
	/// All methods in this interface will be blocked until the RestAPI response.
	/// <para>
	/// If the invoking failed or timeout, the
	/// <seealso cref="com.binance.client.exception.BinanceApiException"/> will be thrown.
	/// </para>
	/// </summary>
	public interface SyncRequestClient
	{

		/// <summary>
		/// Create the synchronous client. All interfaces defined in synchronous client
		/// are implemented by synchronous mode.
		/// </summary>
		/// <returns> The instance of synchronous client. </returns>
//JAVA TO C# CONVERTER TODO TASK: There is no equivalent in C# to Java static interface methods:
//		static SyncRequestClient create()
	//	{
	//		return create("", "", new RequestOptions());
	//	}

		/// <summary>
		/// Create the synchronous client. All interfaces defined in synchronous client
		/// are implemented by synchronous mode.
		/// </summary>
		/// <param name="apiKey">    The public key applied from binance. </param>
		/// <param name="secretKey"> The private key applied from binance. </param>
		/// <returns> The instance of synchronous client. </returns>
//JAVA TO C# CONVERTER TODO TASK: There is no equivalent in C# to Java static interface methods:
//		static SyncRequestClient create(String apiKey, String secretKey)
	//	{
	//		return BinanceApiInternalFactory.getInstance().createSyncRequestClient(apiKey, secretKey, new RequestOptions());
	//	}

		/// <summary>
		/// Create the synchronous client. All interfaces defined in synchronous client
		/// are implemented by synchronous mode.
		/// </summary>
		/// <param name="apiKey">    The public key applied from binance. </param>
		/// <param name="secretKey"> The private key applied from binance. </param>
		/// <param name="options">   The request option. </param>
		/// <returns> The instance of synchronous client. </returns>
//JAVA TO C# CONVERTER TODO TASK: There is no equivalent in C# to Java static interface methods:
//		static SyncRequestClient create(String apiKey, String secretKey, RequestOptions options)
	//	{
	//		return BinanceApiInternalFactory.getInstance().createSyncRequestClient(apiKey, secretKey, options);
	//	}


		/// <summary>
		/// Fetch current exchange trading rules and symbol information.
		/// </summary>
		/// <returns> Current exchange trading rules and symbol information. </returns>
		ExchangeInformation ExchangeInformation {get;}

		/// <summary>
		/// Fetch order book.
		/// </summary>
		/// <returns> Order book. </returns>
		OrderBook getOrderBook(string symbol, int? limit);

		/// <summary>
		/// Get recent trades.
		/// </summary>
		/// <returns> Recent trades. </returns>
		IList<Trade> getRecentTrades(string symbol, int? limit);

		/// <summary>
		/// Get old Trade.
		/// </summary>
		/// <returns> Old trades. </returns>
		IList<Trade> getOldTrades(string symbol, int? limit, long? fromId);

		/// <summary>
		/// Get compressed, aggregate trades.
		/// </summary>
		/// <returns> Aggregate trades. </returns>
		IList<AggregateTrade> getAggregateTrades(string symbol, long? fromId, long? startTime, long? endTime, int? limit);

		/// <summary>
		/// Get kline/candlestick bars for a symbol.
		/// </summary>
		/// <returns> Kline/candlestick bars for a symbol. </returns>
		IList<Candlestick> getCandlestick(string symbol, CandlestickInterval interval, long? startTime, long? endTime, int? limit);

		/// <summary>
		/// Get mark price for a symbol.
		/// </summary>
		/// <returns> Mark price for a symbol. </returns>
		IList<MarkPrice> getMarkPrice(string symbol);

		/// <summary>
		/// Get funding rate history.
		/// </summary>
		/// <returns> funding rate history. </returns>
		IList<FundingRate> getFundingRate(string symbol, long? startTime, long? endTime, int? limit);

		/// <summary>
		/// Get 24 hour rolling window price change statistics.
		/// </summary>
		/// <returns> 24 hour rolling window price change statistics. </returns>
		IList<PriceChangeTicker> get24hrTickerPriceChange(string symbol);

		/// <summary>
		/// Get latest price for a symbol or symbols.
		/// </summary>
		/// <returns> Latest price for a symbol or symbols. </returns>
		IList<SymbolPrice> getSymbolPriceTicker(string symbol);

		/// <summary>
		/// Get best price/qty on the order book for a symbol or symbols.
		/// </summary>
		/// <returns> Best price/qty on the order book for a symbol or symbols. </returns>
		IList<SymbolOrderBook> getSymbolOrderBookTicker(string symbol);

		/// <summary>
		/// Get all liquidation orders.
		/// </summary>
		/// <returns> All liquidation orders. </returns>
		IList<LiquidationOrder> getLiquidationOrders(string symbol, long? startTime, long? endTime, int? limit);

		/// <summary>
		/// Place new orders </summary>
		/// <param name="batchOrders">
		/// @return </param>
		IList<object> postBatchOrders(string batchOrders);

		/// <summary>
		/// Send in a new order.
		/// </summary>
		/// <returns> Order. </returns>
		Order postOrder(string symbol, OrderSide side, PositionSide positionSide, OrderType orderType, TimeInForce timeInForce, string quantity, string price, string reduceOnly, string newClientOrderId, string stopPrice, WorkingType workingType, NewOrderRespType newOrderRespType);

		/// <summary>
		/// Cancel an active order.
		/// </summary>
		/// <returns> Order. </returns>
		Order cancelOrder(string symbol, long? orderId, string origClientOrderId);

		/// <summary>
		/// Cancel all open orders.
		/// </summary>
		/// <returns> ResponseResult. </returns>
		ResponseResult cancelAllOpenOrder(string symbol);

		/// <summary>
		/// Batch cancel orders.
		/// </summary>
		/// <returns> Order. </returns>
		IList<object> batchCancelOrders(string symbol, string orderIdList, string origClientOrderIdList);

		/// <summary>
		/// Switch position side. (true == dual, false == both)
		/// </summary>
		/// <returns> ResponseResult. </returns>
		ResponseResult changePositionSide(bool dual);

		/// <summary>
		/// Change margin type (ISOLATED, CROSSED) </summary>
		/// <param name="symbolName"> </param>
		/// <param name="marginType">
		/// @return </param>
		ResponseResult changeMarginType(string symbolName, string marginType);

		/// <summary>
		/// add isolated position margin </summary>
		/// <param name="symbolName"> </param>
		/// <param name="type"> </param>
		/// <param name="amount"> </param>
		/// <param name="positionSide"> SHORT, LONG, BOTH
		/// @return </param>
		IDictionary<string,object> addIsolatedPositionMargin(string symbolName, int type, string amount, PositionSide positionSide);
        
		/// <summary>
		///  get position margin history </summary>
		/// <param name="symbolName"> </param>
		/// <param name="type"> </param>
		/// <param name="startTime"> </param>
		/// <param name="endTime"> </param>
		/// <param name="limit">
		/// @return </param>
		IList<WalletDeltaLog> getPositionMarginHistory(string symbolName, int type, long startTime, long endTime, int limit);

		/// <summary>
		/// Get if changed to HEDGE mode. (true == hedge mode, false == one-way mode)
		/// </summary>
		/// <returns> ResponseResult. </returns>
		IDictionary<string,object> PositionSide {get;}

		/// <summary>
		/// Check an order's status.
		/// </summary>
		/// <returns> Order status. </returns>
		Order getOrder(string symbol, long? orderId, string origClientOrderId);

		/// <summary>
		/// Get all open orders on a symbol. Careful when accessing this with no symbol.
		/// </summary>
		/// <returns> Open orders. </returns>
		IList<Order> getOpenOrders(string symbol);

		/// <summary>
		/// Get all account orders; active, canceled, or filled.
		/// </summary>
		/// <returns> All orders. </returns>
		IList<Order> getAllOrders(string symbol, long? orderId, long? startTime, long? endTime, int? limit);

		/// <summary>
		/// Get account balances.
		/// </summary>
		/// <returns> Balances. </returns>
		IList<AccountBalance> Balance {get;}

		/// <summary>
		/// Get current account information.
		/// </summary>
		/// <returns> Current account information. </returns>
		AccountInformation AccountInformation {get;}

		/// <summary>
		/// Change initial leverage.
		/// </summary>
		/// <returns> Leverage. </returns>
		Leverage changeInitialLeverage(string symbol, int? leverage);

		/// <summary>
		/// Get position.
		/// </summary>
		/// <returns> Position. </returns>
		IList<PositionRisk> PositionRisk {get;}

		/// <summary>
		/// Get trades for a specific account and symbol.
		/// </summary>
		/// <returns> Trades. </returns>
		IList<MyTrade> getAccountTrades(string symbol, long? startTime, long? endTime, long? fromId, int? limit);

		/// <summary>
		/// Get income history.
		/// </summary>
		/// <returns> Income history. </returns>
		IList<Income> getIncomeHistory(string symbol, IncomeType incomeType, long? startTime, long? endTime, int? limit);

		/// <summary>
		/// Start user data stream.
		/// </summary>
		/// <returns> listenKey. </returns>
		string startUserDataStream();

		/// <summary>
		/// Keep user data stream.
		/// </summary>
		/// <returns> null. </returns>
		string keepUserDataStream(string listenKey);

		/// <summary>
		/// Close user data stream.
		/// </summary>
		/// <returns> null. </returns>
		string closeUserDataStream(string listenKey);

		/// <summary>
		/// Open Interest Stat (MARKET DATA)
		/// </summary>
		/// <returns> Open Interest Stat. </returns>
		IList<OpenInterestStat> getOpenInterestStat(string symbol, PeriodType period, long? startTime, long? endTime, int? limit);

		/// <summary>
		/// Top Trader Long/Short Ratio (Accounts) (MARKET DATA)
		/// </summary>
		/// <returns> Top Trader Long/Short Ratio (Accounts). </returns>
		IList<CommonLongShortRatio> getTopTraderAccountRatio(string symbol, PeriodType period, long? startTime, long? endTime, int? limit);

		/// <summary>
		/// Top Trader Long/Short Ratio (Positions) (MARKET DATA)
		/// </summary>
		/// <returns> Top Trader Long/Short Ratio (Positions). </returns>
		IList<CommonLongShortRatio> getTopTraderPositionRatio(string symbol, PeriodType period, long? startTime, long? endTime, int? limit);

		/// <summary>
		/// Long/Short Ratio (MARKET DATA)
		/// </summary>
		/// <returns> global Long/Short Ratio.  </returns>
		IList<CommonLongShortRatio> getGlobalAccountRatio(string symbol, PeriodType period, long? startTime, long? endTime, int? limit);

		/// <summary>
		/// Taker Long/Short Ratio (MARKET DATA)
		/// </summary>
		/// <returns> Taker Long/Short Ratio.  </returns>
		IList<TakerLongShortStat> getTakerLongShortRatio(string symbol, PeriodType period, long? startTime, long? endTime, int? limit);

	}
}